home *** CD-ROM | disk | FTP | other *** search
/ Internet Surfer 2.0 / Internet Surfer 2.0 (Wayzata Technology) (1996).iso / pc / text / mac / faqs.139 < prev    next >
Text File  |  1996-02-12  |  28KB  |  734 lines

  1. Frequently Asked Questions (FAQS);faqs.139
  2.  
  3.  
  4.  
  5. #!/bin/ksh
  6. #
  7. # Permanently remove a product from disk and AIX databases
  8. #
  9.  
  10. if [ `whoami` != "root" ] ; then
  11.   echo You must be root to run this script.
  12.   exit 1
  13. fi
  14.  
  15. if [ `uname -a | awk '{print $1$4$3}'` != "AIX32" ] ; then
  16.   echo This script only works on AIX 3.2.
  17.   exit 1
  18. fi
  19.  
  20. TMP_FREE=`df /tmp | awk '$3 ~ /[0-9]/{print $3}'`
  21. if [ "$TMP_FREE" -lt 1000 ] ; then
  22.    echo There is not enough room in your /tmp directory.
  23.    echo You need 1000 KB free, and you have only $TMP_FREE KB free.
  24.    echo Either remove some stuff from /tmp, or use chfs to make it bigger.
  25.    exit 1
  26. fi
  27.  
  28. ODMDIRS="/etc/objrepos /usr/lib/objrepos /usr/share/lib/objrepos"
  29. ODMDIR=/usr/lib/objrepos
  30. export ODMDIR
  31.  
  32. if [ $# -lt 1 ]
  33. then
  34.   echo usage: $0 lppname [lppname ...]
  35.   echo lppname is a string compatible with grep, ie "X11" or "PHIGS"
  36.   echo typing   $0 PHIGS   will remove all LPPs with PHIGS in their name.
  37.   exit 1
  38. fi
  39.  
  40. NAMES=$1
  41. shift
  42. while [ $# -gt 0 ] ; do
  43.   NAMES="$NAMES|$1"
  44.   shift
  45. done
  46. echo "Searching for lpps with egrep \"$NAMES\"...\c"
  47.  
  48. for ODMDIR in $ODMDIRS ; do
  49.   if [ ! -d $ODMDIR -o ! -w $ODMDIR ] ; then
  50.      echo $ODMDIR is not writeable or is not a directory.
  51.      echo I hope this is because you are a /usr client or diskless.
  52.      echo If you are not a diskless or a /usr client, you should stop.
  53.      echo "Enter y to continue ->\c"
  54.      read answer
  55.      if [ "$answer" != "y" ] ; then
  56.        exit 0
  57.      fi
  58.   fi
  59.   TMP=`odmget lpp | awk -F\" '/name/ {print $2}' | egrep "$NAMES"`
  60.   LPPS=`echo $LPPS $TMP`
  61. done
  62.  
  63. if [ "$LPPS" = "" ]
  64. then
  65.   echo "failed.\nNo LPP with the name $NAMES detected."
  66.   exit 1
  67. fi
  68. echo ok.
  69.  
  70. for ODMDIR in $ODMDIRS ; do
  71.   mkdir -p /tmp/rmlpp/$ODMDIR > /dev/null 2>&1
  72. done
  73.  
  74. > /tmp/listOfFilesToRM$$    # truncate temporary file, just in case.
  75. echo
  76. echo This script is about to attempt to remove an LPP from your system.
  77. echo I say attempt, because it could fail.  If it fails, you may have
  78. echo to at least reload the LPP.  Use the \"lppchk\" command to make sure
  79. echo all is well with your system.
  80. echo
  81. # Loop through all the LPP names found.
  82. for LPP in $LPPS
  83. do
  84.   DESCR=none
  85.   answer=""
  86.  
  87.   # find the LPP ids.  They will be different in the three SWVPD databases.
  88.   for ODMDIR in $ODMDIRS ; do
  89.     # get the lpp id for this ODMDIR (yes, they are different)
  90.     LPPID=`odmget -q name=$LPP lpp | grep lpp_id | sed 's/.* = //'`
  91.  
  92.     # did we find the LPP?
  93.     if [ "$DESCR" = "none" -a "$LPPID" != ""  ] ; then
  94.       # all the descriptions should be the same
  95.       DESCR=`odmget -q name=$LPP lpp | grep description | sed 's/.* = //'`
  96.       echo "Delete $LPP, $DESCR?"
  97.       echo "y or (n) ->\c"
  98.       read answer
  99.       if [ "$answer" != "y" ] ; then # jump back up to the next LPP name
  100.         continue 2
  101.       fi
  102.     fi
  103.     # if there is no DESCR, then we didn't find the LPP.  Weird.
  104.     if [ "$DESCR" = "none" -o "$LPPID" = "" ] ; then
  105.       continue
  106.     fi
  107.     SOMETHING_DONE_FLAG=true
  108.     # Optionally, save the ODM stuff we are about to remove,
  109.     # in case something goes wrong.  The problem is it is difficult
  110.     # to determine if something really did fail, since these commands
  111.     # don't return any decent error return codes.
  112.     odmget -q lpp_id=$LPPID history   > /tmp/rmlpp/$ODMDIR/$LPP.history
  113.     odmget -q name=$LPP lpp           > /tmp/rmlpp/$ODMDIR/$LPP.lpp
  114.     odmget -q lpp_name=$LPP product   > /tmp/rmlpp/$ODMDIR/$LPP.product
  115.     # Get the list of files and links to remove later....
  116.     odmget -q lpp_id=$LPPID inventory > /tmp/rmlpp/$ODMDIR/$LPP.inventory
  117.     awk -F\" '/loc/ {print $2}' /tmp/rmlpp/$ODMDIR/$LPP.inventory | \
  118.       sed 's/,/ /g' >> /tmp/listOfFilesToRM$$
  119.     odmdelete -o history -q lpp_id=$LPPID   > /dev/null 2>&1
  120.     odmdelete -o lpp -q name=$LPP           > /dev/null 2>&1
  121.     odmdelete -o product -q lpp_name=$LPP   > /dev/null 2>&1
  122.     odmdelete -o inventory -q lpp_id=$LPPID > /dev/null 2>&1
  123.   done
  124. done
  125.  
  126. if [ "$SOMETHING_DONE_FLAG" = "true" ] ; then
  127.  
  128.   echo ODM work is done.  Now, time to delete files....
  129.  
  130.   # This could be catastrophic if there is a problem.  For example,
  131.   # if the ODM database for an application had / as one of its files.
  132.   # You be the judge.  Here's your rope....
  133.   cat /tmp/listOfFilesToRM$$ | sort -r | uniq | xargs rm -rf
  134.  
  135.   rm -rf /tmp/listOfFilesToRM$$
  136.   echo done.
  137. fi
  138.  
  139. # take this line out if you want to save your ODM saved files.
  140. rm -rf /tmp/rmlpp
  141.  
  142. exit 0
  143.  
  144.  
  145. 1.25 *My named dies frequently, why?
  146.  
  147. Running on 3.2, named dies frequently on network's primary name server.
  148.  
  149. From: jpe@ee.egr.duke.edu (John P. Eisenmenger)
  150.  
  151. Try the following:
  152.  
  153.      stopsrc -s named    # stop running named
  154.      setenv MALLOCTYPE 3.1    # use 3.1 memory allocation algorithm
  155.      /etc/named ...        # don't use smit to start named
  156.  
  157. You might be able to use startsrc/smit after setting MALLOCTYPE and get
  158. the same effect, but I'm not sure.
  159.  
  160. [According to John, the problem is malloc() in the named code. He
  161.  also suggests using Berkeley's bind, which he has ported and can be
  162.  ftp'ed from ftp.egr.duke.edu, /archives/network/bind-4.8.3.tar.Z. -ed]
  163.  
  164.  
  165. 1.26: How do I trace ethernet packets on an AIX system?
  166. From: afx@muc.ibm.de (Andreas Siegert)
  167.  
  168. Do the following:
  169.  
  170.      iptrace -i en0 /tmp/ipt
  171.  
  172. The iptrace backgrounds.  Find its process id and kill it when you are
  173. ready.  Then run
  174.  
  175.      ipreport -rns /tmp/ipt >/tmp/ipr
  176.  
  177. and look at the output.  The current version of Info does not document
  178. the r, n and s options but they are quite useful for layering the output.
  179.  
  180. ______________________________________________________________________________
  181. 2.00: C/C++
  182.  
  183. Contrary to many people's belief, the C environment on the RS/6000 is
  184. not very special.  The C compiler has quite a number of options that can
  185. be used to control how it works, which "dialect" of C it compiles, how
  186. it interprets certain language constructs, etc.  InfoExplorer includes a
  187. Users' Guide and a Reference Manual.
  188.  
  189. The compiler can be invoked with either xlc to invoke it in ANSI mode
  190. and cc to invoke it in RT (i.e. IBM 6150 with AIX 2) compatible mode.
  191. The default options for each mode are set in the /etc/xlc.cfg file, and
  192. you can actually add another stanza and create a link to the /bin/xlc
  193. executable.
  194.  
  195. The file /usr/lpp/xlc/bin/README.xlc has information about the C
  196. compiler, and the file /usr/lpp/bos/bsdport contains useful information,
  197. in particular for users used to BSD.
  198.  
  199. The file /etc/xlc.cfg also shows the symbol _IBMR2 that is predefined,
  200. and therefore can be used for #ifdef'ing RS/6000 specific code.
  201.  
  202.  
  203. 2.01: I cannot make alloca work
  204.  
  205. A famous routine, in particular in GNU context, is the allocation
  206. routine alloca().  Alloca allocates memory in such a way that it is
  207. automatically free'd when the block is exited.  Most implementations
  208. does this by adjusting the stack pointer.  Since not all C environments
  209. can support it, its use is discouraged, but it is included in the xlc
  210. compiler.  In order to make the compiler aware that you intend to use
  211. alloca, you must put the line
  212.  
  213. #pragma alloca
  214.  
  215. before any other statements in the C source module(s) where alloca is
  216. called.  If you don't do this, xlc will not recognize alloca as anything
  217. special, and you will get errors during linking.
  218.  
  219. In earlier releases of the C compiler, alloca did not work well with the
  220. optimizer turned on (-O flag), but this problem is solved now.  The fix
  221. was probably in release 1.1.3 of xlc.obj, it is for sure in 1.1.5.
  222.  
  223.  
  224. 2.02: How do I compile my BSD programs?
  225.  
  226. The file /usr/lpp/bos/bsdport contains information on how to port
  227. programs written for BSD to AIX 3.1.  The contents of this file can
  228. actually be very useful for others as well.
  229.  
  230. A quick cc command for most "standard" BSD programs is:
  231.  
  232.   $ cc -D_BSD -D_BSD_INCLUDES  -o [loadfile] [sourcefile.c] -lbsd
  233.  
  234. If your software has system calls predefined with no prototype
  235. parameters, also use the -D_NO_PROTO flag.
  236.  
  237.  
  238. 2.03: Isn't the linker different from what I am used to?
  239.  
  240. Yes.  It is not at all like what you are used to:
  241.  
  242. - The order of objects and libraries is normally _not_ important.  The
  243.   linker reads _all_ objects including those from libraries into memory
  244.   and does the actual linking in one go.  Even if you need to put a
  245.   library of your own twice on the ld command line on other systems, it
  246.   is not needed on the RS/6000 - doing so will even make your linking slower.
  247.  
  248. - One of the features of the linker is that it will replace an object in
  249.   an executable with a new version of the same object:
  250.  
  251.   $ cc -o prog prog1.o prog2.o prog3.o        # make prog
  252.   $ cc -c prog2.c                # recompile prog2.c
  253.   $ cc -o prog.new prog2.o prog            # make prog.new from prog
  254.                         # by replacing prog2.o
  255.  
  256. - The standard C library /lib/libc.a is linked shared, which means that
  257.   the actual code is not linked into your program, but is loaded only
  258.   once and linked dynamically during loading of your program.
  259.  
  260. - The ld program actually calls the binder in /usr/lib/bind, and you can
  261.   give ld special options to get details about the invocation of the
  262.   binder.  These are found on the ld man page or in InfoExplorer.
  263.  
  264. - If your program normally links using a number of libraries (.a files),
  265.   you can 'prelink' each of these into an object, which will make your
  266.   final linking faster.  E.g. do:
  267.  
  268.   $ cc -c prog1.c prog2.c prog3.c
  269.   $ ar cv libprog.a prog1.o prog2.o prog3.o
  270.   $ ld -r -o libprog.o libprog.a
  271.   $ cc -o someprog someprog.c libprog.o
  272.  
  273. This will solve all internal references between prog1.o, prog2.o and
  274. prog3.o and save this in libprog.o Then using libprog.o to link your
  275. program instead of libprog.a will increase linking speed, and even if
  276. someprog.c only uses, say prog1.o and prog2.o, only those two modules
  277. will be in your final program.  This is also due to the fact that the
  278. binder can handle single objects inside one object module as noted above.
  279.  
  280. If you are using an -lprog option (for libprog.a) above, and still want
  281. to be able to do so, you should name the prelinked object with a
  282. standard library name, e.g. libprogP.a (P identifying a prelinked
  283. object), that can be specified by -lprogP.  You cannot use the archiver
  284. (ar) on such an object.
  285.  
  286. You should also have a look at section 3.01 of this article, in
  287. particular if you have mixed Fortran/C programs.
  288.  
  289.  
  290. 2.04: How do I link my program with a non-shared /lib/libc.a?
  291.  
  292.   cc -o prog -bnoso -bI:/lib/syscalls.exp obj1.o obj2.o obj3.o
  293.  
  294. will do that for a program consisting of the three objects obj1.o, etc.
  295.  
  296.  
  297. 2.05: How do I make my own shared library?
  298.  
  299. To make your own shared object or library of shared objects, you should
  300. know that a shared object cannot have undefined symbols.  Thus, if your
  301. code uses any externals from /lib/libc.a, the latter MUST be linked with
  302. your code to make a shared object.  Likewise, you cannot split your code
  303. into more than one shared object if externals in one object refer to
  304. another one.
  305.  
  306. Assume you have one file, sub1.c, containing a routine with no external
  307. references, and another one, sub2.c, calling stuff in /lib/libc.a.  You
  308. will also need two export files, sub1.exp, sub2.exp.  Read the example
  309. below together with the examples on the ld man page.
  310.  
  311. ---- sub1.c ----------------------------------------------------------
  312.     int addint(int a, int b)
  313.     {
  314.       return a + b;
  315.     }
  316. ---- sub2.c ----------------------------------------------------------
  317.     #include <stdio.h>
  318.  
  319.     void printint(int a)
  320.     {
  321.       printf("The integer is: %d\n", a);
  322.     }
  323. ---- sub1.exp ----------------------------------------------------------
  324.     #!
  325.     addint
  326. ---- sub2.exp ----------------------------------------------------------
  327.     #!
  328.     printint
  329. ---- usesub.c ----------------------------------------------------------
  330.     main()
  331.     {
  332.       printint( addint(5,8) );
  333.     }
  334. ---------------------------------------------------------------
  335.  
  336. The following commands will build your libshr.a, and compile/link the
  337. program usesub to use it.  Note that you need the ld option -lc for
  338. sub2shr.o since it calls printf from /lib/libc.a.
  339.  
  340.   $ cc  -c sub1.c
  341.   $ ld -o sub1shr.o sub1.o -bE:sub1.exp -bM:SRE -T512 -H512
  342.   $ cc  -c sub2.c
  343.   $ ld -o sub2shr.o sub2.o -bE:sub2.exp -bM:SRE -T512 -H512  -lc
  344.   $ ar r libshr.a sub1shr.o sub2shr.o
  345.   $ cc -o usesub usesub.c -L: libshr.a
  346.   $ usesub
  347.   The integer is: 13
  348.   $
  349.  
  350.  
  351. 2.06: Linking my program fails with strange errors.  Why?
  352.  
  353. Very simple, the linker (actually called the binder), cannot get the
  354. memory it needs, either because your ulimits are too low or because you
  355. don't have sufficient paging space.  Since the linker is quite different
  356. from normal Unix linkers and actually does much more than these, it also
  357. uses a lot of virtual memory.  It is not unusual to need 10000 pages (of
  358. 4k) or more to execute a fairly complex linking.
  359.  
  360. If you get 'BUMP error', either ulimits or paging is too low, if you get
  361. 'Binder killed by signal 9' your paging is too low.
  362.  
  363. First, check your memory and data ulimits; in korn shell 'ulimit -a' will
  364. show all limits and 'ulimit -m 99999' and 'ulimit -d 99999' will
  365. increase the maximum memory and data respectively to some high values.
  366. If this was not your problem, you don't have enough paging space.
  367.  
  368. If you will or can not increase your paging space, you could try this:
  369.  
  370. - Do you duplicate libraries on the ld command line? That is never
  371.   necessary.
  372.  
  373. - Do more users link simultaneously? Try having only one linking going
  374.   on at any time.
  375.  
  376. - Do a partwise linking, i.e.  you link some objects/libraries with the
  377.   -r option to allow the temporary output to have unresolved references,
  378.   then link with the rest of your objects/libraries.  This can be split
  379.   up as much as you want, and will make each step use less virtual memory.
  380.  
  381.   If you follow this scheme, only adding one object or archive at a
  382.   time, you will actually emulate the behavior of other Unix linkers.
  383.  
  384. If you decide to add more paging space, you should consider adding a new
  385. paging space on a second hard disk, as opposed to just increasing the
  386. existing one.  Doing the latter could make you run out of free space on
  387. your first harddisk. It is more involved to shrink a paging space
  388. but easier to delete one.
  389.  
  390. --
  391. Luis Basto
  392. Computer Sciences Corporation
  393. Internet: basto@cactus.org
  394. Usenet:   cs.utexas.edu!mavrick!luis
  395. Xref: bloom-picayune.mit.edu comp.unix.aix:19872 news.answers:4575
  396. Path: bloom-picayune.mit.edu!enterpoop.mit.edu!usc!wupost!cs.utexas.edu!mavrick!basto@cactus.org
  397. From: basto@cactus.org (Luis Basto)
  398. Newsgroups: comp.unix.aix,news.answers
  399. Subject: AIX Frequently Asked Questions (Part 2 of 2)
  400. Summary: This posting contains a list of Frequently Asked Questions
  401.          and their answers about AIX, IBM's version of Unix.
  402. Keywords: AIX RS/6000 questions answers
  403. Message-ID: <1070@mavrick.UUCP>
  404. Date: 14 Dec 92 07:22:02 GMT
  405. Expires: 15 Jan 93 01:23:45 GMT
  406. Sender: luis@mavrick.UUCP
  407. Reply-To: basto@cactus.org (Luis Basto)
  408. Followup-To: comp.unix.aix
  409. Lines: 1156
  410. Approved: news-answers-request@MIT.Edu
  411.  
  412. Archive-name: aix-faq/part2
  413. Last-modified: Dec 12, 1992
  414. Version: 2.0
  415.  
  416.  
  417. Version: $Id: aix.faq,v 2.0 12/12/92 basto $
  418.  
  419. Frequently Asked Questions to AIX 3.x and IBM RS/6000
  420. _____________________________________________________
  421.  
  422. 2.07: What's with malloc()?
  423.  
  424. malloc() uses a late allocation algorithm based on 4.3 BSD's malloc()
  425. for speed.  This lets you allocate very large sparse memory spaces,
  426. since the pages are not actually allocated until they are touched for
  427. the first time.  Unfortunately, it doesn't die gracefully in the face of
  428. loss of available memory.  See the "Paging Space Overview" under
  429. InfoExplorer, and see the notes on the linker in this document for an
  430. example of an ungraceful death.
  431.  
  432. If you want your program to get notified when running out of memory, you
  433. should handle the SIGDANGER signal.  The default is to ignore it.
  434. SIGDANGER is sent to all processes when paging space gets low, and if
  435. paging space gets even lower, processes with the highest paging space
  436. usage are sent the SIGKILL signal.
  437.  
  438. malloc() is substantially different in 3.2, allocating memory more
  439. tightly.  If you have problems running re-compiled programs on 3.2, try
  440. compiling them with MALLOCTYPE=3.1.
  441.  
  442.  
  443. 2.08: Why does xlc complain about 'extern char *strcpy()'
  444.  
  445. The header <string.h> has a strcpy macro that expands strcpy(x,y) to
  446. __strcpy(x,y), and the latter is then used by the compiler to generate
  447. inline code for strcpy.  Because of the macro, your extern declaration
  448. contains an invalid macro expansion.  The real cure is to remove your
  449. extern declaration but adding -U__STR__ to your xlc will also do the trick.
  450.  
  451.  
  452. 2.09: Why do I get 'Parameter list cannot contain fewer ....'
  453.  
  454. This is the same as above.
  455.  
  456.  
  457. 2.10: Why does xlc complain about '(sometype *)somepointer = something'
  458.  
  459. Software that is developed using GNUC may have this construct.  However,
  460. standard C does not permit casts to be lvalues, so you will need to
  461. change the cast and move it to the right side of the assignment.  If you
  462. compile with 'cc', removing the cast completely will give you a warning,
  463. 'xlc' will give you an error (provided somepointer and something are of
  464. different types - but else, why would the cast be there in the first place?)
  465.  
  466.  
  467. 2.11: Some more common errors
  468.  
  469. Here are a few other common errors with xlc:
  470.  
  471. 305 |     switch((((np)->navigation_type) ? (*((np)->navigation_type)) :
  472.       ((void *)0)))
  473.       .a...........
  474. a - 1506-226: (S) The second and third operands of the conditional
  475. operator must be of the same type.
  476.  
  477. The reason for this is that xlc defines NULL as (void *)0, and it does
  478. not allow two different types as the second and third operand of ?:.
  479. The second argument above is not a pointer and the code used NULL
  480. incorrectly as a scalar.  NULL is a nil pointer constant in ANSI C and
  481. in some traditional compilers.
  482.  
  483. You should change NULL in the third argument above to an integer 0.
  484.  
  485.  
  486. 2.12: Can the compiler generate assembler code?
  487.  
  488. The traditional -S option is not supported by the XLC compiler, and
  489. there is in fact no way to make the compiler generate machine readable
  490. assembler code.  The option -qlist will generate a human readable one in
  491. the .lst file.
  492.  
  493.  
  494. 2.13: Curses
  495.  
  496. Curses based applications should be linked with -lcurses and _not_ with
  497. -ltermlib.  It has also been reported that some problems with curses are
  498. avoided if your application is compiled with -DNLS.
  499.  
  500. Peter Jeffe <peter@ski.austin.ibm.com> also notes:
  501.  
  502. >the escape sequences for cursor and function keys are *sometimes*
  503. >treated as several characters: eg. the getch() - call does not return
  504. >KEY_UP but 'ESC [ C.'
  505.  
  506. You're correct in your analysis: this has to do with the timing of the
  507. escape sequence as it arrives from the net.  There is an environment
  508. variable called ESCDELAY that can change the fudge factor used to decide
  509. when an escape is just an escape.  The default value is 500; boosting
  510. this a bit should solve your problems.
  511.  
  512. Further on the matter of curses, I've received the comments below
  513. concerning extended curses:
  514.  
  515. From: Christopher Carlyle O'Callaghan <asdfjkl@wam.umd.edu>
  516.  
  517. 1) The sample program in User Interface Programming Concepts, page 7-13
  518.    is WRONG. Here is the correct use of panes and panels.  (This is
  519.    one of the IBM manuals that comes with the RS/6000)
  520.  
  521. #include <cur01.h>
  522. #include <cur05.h>
  523.  
  524. main()
  525. {
  526. PANE *A, *B, *C, *D, *E, *F, *G, *H;
  527. PANEL *P;
  528.  
  529. initscr();
  530.  
  531. A = ecbpns (24, 79, NULL, NULL, 0, 2500, Pdivszp, Pbordry, NULL, NULL);
  532.  
  533. D = ecbpns (24, 79, NULL, NULL, 0, 0,    Pdivszf, Pbordry, NULL, NULL);
  534. E = ecbpns (24, 79, D,    NULL, 0, 0,    Pdivszf, Pbordry, NULL, NULL);
  535.  
  536. B = ecbpns (24, 79, A, D, Pdivtyh, 3000, Pdivszp, Pbordry, NULL, NULL);
  537.  
  538. F = ecbpns (24, 79, NULL, NULL, 0, 0,    Pdivszf, Pbordry, NULL, NULL);
  539. G = ecbpns (24, 79, F,    NULL, 0, 5000, Pdivszp, Pbordry, NULL, NULL);
  540. H = ecbpns (24, 79, G,    NULL, 0, 3000, Pdivszp, Pbordry, NULL, NULL);
  541.  
  542. C: = ecbpns (24, 79, B, F, Pdivtyh, 0, Pdivszf, Pbordry, NULL, NULL);
  543.  
  544. P = ecbpls (24, 79, 0, 0, "MAIN PANEL", Pdivtyv, Pbordry, A);
  545.  
  546. ecdvpl (P);
  547. ecdfpl (P, FALSE);
  548. ecshpl (P);
  549. ecrfpl (P);
  550. endwin();
  551. }
  552.  
  553. 2) DO NOT include <curses.h> and any other <cur0x.h> file together.
  554.    You will get a bunch of redefined statements.
  555.  
  556. 3) There is a CURSES and EXTENDED CURSES stuff.  Use only one or the
  557.    other. If the manual says that they're backwards compatible or some
  558.    other indication that you can use CURSES routines with EXTENDED,
  559.    don't believe it. To use CURSES you need to include <curses.h> and
  560.    you can't (see above).
  561.  
  562. 4) If you use -lcur and -lcurses in the same link command, you will get
  563.    Memory fault (core dump) error...  YOU CANNOT use both of them at the
  564.    same time. -lcur is for extended curses, -lcurses is for regular curses.
  565.  
  566. 5) When creating PANEs, when you supply a value (other than 0) for the
  567.    'ds' parameter and use Pdivszf value for the 'du' parameter, the 'ds'
  568.    will be ignored (the sample program on page 7-13 in User Interface
  569.    Programming Concepts is wrong.) For reasons as yet undetermined,
  570.    Pdivszc doesn't seem to work (or at least I can't figure out how to
  571.    use it.)
  572.  
  573. 6) If you're running into bugs and can't figure out what is happening,
  574.    try the following:
  575.    include -qextchk -g in your compile line
  576.     -qextchk will check to make sure you're passing the right number of
  577.        parameters to the procedures
  578.     -g will allow you to use the inline debugger on Unix/AIX.
  579.    to use the debugger after you compiled it,
  580.     type: dbx <fn>
  581.     the command 'help' will give you all of the possible commands to
  582.        use in the debugger... have fun... :)
  583.  
  584. 7) Do not use 80 as the number of columns if you're gonna use the whole
  585.    screen. The lower right corner will get erased.  Use 79 instead.
  586.  
  587. 8) If you create a panel, you must create at least 1 pane, otherwise you
  588.    will get a Memory fault (core dump).
  589.  
  590. 9) When creating a panel, if you don't have a border around it, any title
  591.    you want will not show up.
  592.  
  593. 10) to make the screen scroll down:
  594.     wmove (win, 0, 0);
  595.     winsertln (win)
  596.  
  597. 11) delwin(win) DOESN'T WORK IN EXTENDED WINDOWS.
  598.  
  599.     Anyway.. to make it appear as if a window is deleted, you need to do
  600.     the following:
  601.     for every window that you want to appear on the screen
  602.     touchwin(win)
  603.     wrefresh(win)
  604.  
  605.     you must make sure that you do it in the exact same order as you put
  606.     them on the screen (i.e., if you called newwin with A, then C, then B,
  607.     then you must do the loop with A, then C, then B, otherwise you won't
  608.     get the same screen back).  The best thing to do is to put them into
  609.     an array and keep track the of last window index.
  610.  
  611. 12) mvwin(win, line, col) implies that it is only used for viewports and
  612.     subwindows... It can also be used for the actual windows themselves.
  613.  
  614. 13) If you specify the attribute of a window using wcolorout(win), any
  615.     subsequent calls to chgat(numchars, mode) or any of it's relatives
  616.     will not work. (or at least they get very picky...)
  617.  
  618.  
  619. 2.14: How do I speed up linking
  620.  
  621. Please refer to sections 2.03 and 2.06 above.
  622.  
  623.  
  624. 2.15: What is deadbeef?
  625.  
  626. When running the debugger (dbx), you may have wondered what the
  627. 'deadbeef' is you occasionally see in registers.  Do note, that
  628. 0xdeadbeef is a hexadecimal number that also happens to be some kind
  629. of word (the RS/6000 was built in Texas!), and this hexadecimal number
  630. is simply put into unused registers at some time, probably during
  631. program startup.
  632.  
  633. _____________________________________________________________________________
  634. 3.00: Fortran and other compilers
  635.  
  636. This section covers Fortran, Pascal, Ada, etc.  On fortran, there seem
  637. to have been some problems with floating point handling, in particular
  638. floating exceptions.
  639.  
  640.  
  641. 3.01: I have problems mixing fortran and C code, why?
  642.  
  643. A few routines (the most famous one is getenv) exist in both the fortran
  644. and the C library but with different parameters.  You can therefore not
  645. have a mixed program that call getenv from both C and fortran code.
  646. When linking a mixed program calling getenv from either, be sure to
  647. specify the correct library first on your command line.  If your main
  648. program is fortran and you call getenv from a C routine, you must
  649. therefore add -lc to the xlf command line for linking.
  650.  
  651. If you want to call getenv from both C and fortran code in a mixed
  652. program, you need to compile all the fortran code with the -qextname
  653. option.  This appends an underscore to all fortran external names and
  654. ensures that no confusion occurs with default C libraries.  Of course an
  655. underscore should be added by hand in the C code to the name of all
  656. routines which are called form fortran and to all calls to fortran
  657. routines.  If you do that, fortran will call something which appears to
  658. C as getenv_ and there will be no confusion.
  659.  
  660.  
  661. 3.02: How do I statically bind fortran libraries and dynamically
  662.       bind C libraries?
  663. From: amaranth@vela.acs.oakland.edu (Paul Amaranth)
  664.  
  665. [ Editor's note: Part of this is also discussed above under the C compiler
  666.   discussions, but I felt it was so valuable that I have left it all in.
  667.   I've done some minor editing, mostly typographical. ]
  668.  
  669. The linker and binder are rather versatile programs, but it is not
  670. always clear how to make them do what you want them to.  In particular,
  671. there are times when you do not want to use shared libraries, but
  672. rather, staticly bind the required routines into your object.  Or, you
  673. may need to use two version of the same routine (eg, Fortran & C).  Here
  674. are the results of my recent experiments.  I would like to thank Daniel
  675. Premer and Brad Hollowbush, my SE, for hints.  Any mistakes or omissions
  676. are my own and I have tended to interchange the terms "linker" and
  677. "binder".  These experiments were performed on AIX 3.1.2.  Most of this
  678. should be applicable to later upgrades of 3.1.
  679.  
  680. 1)  I have some C programs, I want to bind in the runtime routines.  How
  681.     do I do this? [Mentioned in section 2.04 of this article as well, ed.]
  682.  
  683.     You can put the -bnso binder command on the link line.  You should
  684.     also include the -bI:/lib/syscalls.exp control argument:
  685.  
  686.       $ cc *.o -bnso -bI:/lib/syscalls.exp -o foo
  687.  
  688.     This will magically do everything you need.  Note that this will bind
  689.     _all_ required routines in.  The -bI argument tells the linker that
  690.     these entry points will be resolved dynamically at runtime (these are
  691.     system calls).  If you omit this you will get lots of unresolved
  692.     reference messages.
  693.  
  694. 2)  I want to staticly bind in the Fortran runtime so a) my customers do
  695.     not need to buy it and b) I don't have to worry about the runtime
  696.     changing on a new release.  Can I use the two binder arguments in
  697.     1) to do this?
  698.  
  699.     You should be able to do so, but, at least under 3002, if you do
  700.     you will get a linker error referencing getenv.  In addition, there
  701.     are a number of potential conflicts between Fortran and C routines.
  702.     The easy way just does not work.  See the section on
  703.     2 stage linking for C and Fortran on how to do this.  The getenv
  704.     problem is a mess, see the section on Comments & Caveats for more.
  705.  
  706. 3)  I have a mixture of C and Fortran routines, how can I make sure
  707.     that the C routines reference the C getenv, while the Fortran routines
  708.     reference the Fortran getenv (which has different parameters and, if
  709.     called mistakenly by a C routine results in a segmentation fault)?
  710.  
  711.     You can't.  Only one symbol definition is allowed, and it will be the
  712.     _first_ definition on the _last_ link.  Here is the quote from the
  713.     ld info file:
  714.  
  715.        In this version of ld, the first definition of each symbol in
  716.        the link takes precedence and is used even if the first reference
  717.        follows the definition.
  718.  
  719.     The only way I can possibly think of to do this is extremely messy:
  720.     Make the C and Fortran routines separate modules.  Staticly bind them
  721.     with their libraries.  Have them dynamicly call each other.  ech.
  722.     I haven't tried this, however.
  723.  
  724.     If you want to bind everything together, write yourself an interface
  725.     in one language to use the other's routine.  I did this with getenv
  726.     and it works tolerably well.
  727.  
  728. 4)  I have C and Fortran routines.  I want to bind in the xlf library, while
  729.     letting the rest of the libraries be shared.  How do I do this?
  730.  
  731.     You need to do a 2 stage link.  In the first stage, you bind in the
  732.     xlf library routines, creating an intermediate object file.  The
  733.     second stage resolves the remaining references to the shared libraries.
  734.